package com.fastbee.oss.domain;

import cn.xuyanwu.spring.file.storage.FileInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fastbee.common.annotation.Excel;
import com.fastbee.common.core.domain.BaseEntity;

/**
 * 文件记录对象 oss_detail
 *
 * @author zhuangpeng.li
 * @date 2023-03-30
 */
@ApiModel(value = "OssDetail", description = "文件记录对象 oss_detail")
public class OssDetail extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 文件id */
    @ApiModelProperty("文件id")
    private Integer id;

    /** 文件访问地址 */
    @ApiModelProperty("文件访问地址")
    @Excel(name = "文件访问地址")
    private String url;

    /** 文件大小，单位字节 */
    @ApiModelProperty("文件大小，单位字节")
    @Excel(name = "文件大小，单位字节")
    private Long size;

    /** 文件名称 */
    @ApiModelProperty("文件名称")
    @Excel(name = "文件名称")
    private String filename;

    /** 原始文件名 */
    @ApiModelProperty("原始文件名")
    @Excel(name = "原始文件名")
    private String originalFilename;

    /** 基础存储路径 */
    @ApiModelProperty("基础存储路径")
    @Excel(name = "基础存储路径")
    private String basePath;

    /** 存储路径 */
    @ApiModelProperty("存储路径")
    @Excel(name = "存储路径")
    private String path;

    /** 文件扩展名 */
    @ApiModelProperty("文件扩展名")
    @Excel(name = "文件扩展名")
    private String ext;

    /** 存储平台 */
    @ApiModelProperty("存储平台")
    @Excel(name = "存储平台")
    private String platform;

    /** 缩略图访问路径 */
    @ApiModelProperty("缩略图访问路径")
    @Excel(name = "缩略图访问路径")
    private String thUrl;

    /** 缩略图名称 */
    @ApiModelProperty("缩略图名称")
    @Excel(name = "缩略图名称")
    private String thFilename;

    /** 缩略图大小，单位字节 */
    @ApiModelProperty("缩略图大小，单位字节")
    @Excel(name = "缩略图大小，单位字节")
    private Long thSize;

    /** 文件所属对象id */
    @ApiModelProperty("文件所属对象id")
    @Excel(name = "文件所属对象id")
    private String objectId;

    /** 文件所属对象类型，例如用户头像，评价图片 */
    @ApiModelProperty("文件所属对象类型")
    @Excel(name = "文件所属对象类型，例如用户头像，评价图片")
    private String objectType;

    /** 删除标志（0代表存在 2代表删除） */
    @ApiModelProperty("删除标志")
    private String delFlag;
    public OssDetail(){}
    public OssDetail(FileInfo fileInfo) {
        this.basePath = fileInfo.getBasePath();
        this.path = fileInfo.getPath();
        this.filename = fileInfo.getFilename();
        this.originalFilename = fileInfo.getOriginalFilename();
        this.size = fileInfo.getSize();
        this.ext = fileInfo.getExt();
        this.platform = fileInfo.getPlatform();
        this.url = fileInfo.getUrl();
        this.thUrl = fileInfo.getThUrl();
        this.thFilename = fileInfo.getThFilename();
        this.thSize = fileInfo.getThSize();
        this.objectId = fileInfo.getObjectId();
        this.objectType = fileInfo.getObjectType();
    }
    public FileInfo tofileInfo() {
        FileInfo fileInfo = new FileInfo();
        fileInfo.setBasePath(this.basePath);
        fileInfo.setPath(this.path);
        fileInfo.setFilename(this.filename);
        fileInfo.setOriginalFilename(this.originalFilename);
        fileInfo.setSize(this.size);
        fileInfo.setExt(this.ext);
        fileInfo.setPlatform(this.platform);
        fileInfo.setUrl(this.url);
        fileInfo.setThUrl(this.thUrl);
        fileInfo.setThFilename(this.thFilename);
        fileInfo.setThSize(this.thSize);
        fileInfo.setObjectId(this.objectId);
        fileInfo.setObjectType(this.objectType);
        return fileInfo;
    }
    public void setId(Integer id)
    {
        this.id = id;
    }

    public Integer getId()
    {
        return id;
    }
    public void setUrl(String url)
    {
        this.url = url;
    }

    public String getUrl()
    {
        return url;
    }
    public void setSize(Long size)
    {
        this.size = size;
    }

    public Long getSize()
    {
        return size;
    }
    public void setFilename(String filename)
    {
        this.filename = filename;
    }

    public String getFilename()
    {
        return filename;
    }
    public void setOriginalFilename(String originalFilename)
    {
        this.originalFilename = originalFilename;
    }

    public String getOriginalFilename()
    {
        return originalFilename;
    }
    public void setBasePath(String basePath)
    {
        this.basePath = basePath;
    }

    public String getBasePath()
    {
        return basePath;
    }
    public void setPath(String path)
    {
        this.path = path;
    }

    public String getPath()
    {
        return path;
    }
    public void setExt(String ext)
    {
        this.ext = ext;
    }

    public String getExt()
    {
        return ext;
    }
    public void setPlatform(String platform)
    {
        this.platform = platform;
    }

    public String getPlatform()
    {
        return platform;
    }
    public void setThUrl(String thUrl)
    {
        this.thUrl = thUrl;
    }

    public String getThUrl()
    {
        return thUrl;
    }
    public void setThFilename(String thFilename)
    {
        this.thFilename = thFilename;
    }

    public String getThFilename()
    {
        return thFilename;
    }
    public void setThSize(Long thSize)
    {
        this.thSize = thSize;
    }

    public Long getThSize()
    {
        return thSize;
    }
    public void setObjectId(String objectId)
    {
        this.objectId = objectId;
    }

    public String getObjectId()
    {
        return objectId;
    }
    public void setObjectType(String objectType)
    {
        this.objectType = objectType;
    }

    public String getObjectType()
    {
        return objectType;
    }
    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }

    public String getDelFlag()
    {
        return delFlag;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("url", getUrl())
            .append("size", getSize())
            .append("filename", getFilename())
            .append("originalFilename", getOriginalFilename())
            .append("basePath", getBasePath())
            .append("path", getPath())
            .append("ext", getExt())
            .append("platform", getPlatform())
            .append("thUrl", getThUrl())
            .append("thFilename", getThFilename())
            .append("thSize", getThSize())
            .append("objectId", getObjectId())
            .append("objectType", getObjectType())
            .append("delFlag", getDelFlag())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .toString();
    }
}
